package com.alks.function.controller.finance.fincons;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.RoleCheck;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.dto.chengKong.cost.PcStitchProdDetailDto2;
import com.alks.function.data.dto.chengKong.cost.pcStitchProdDetailDto;
import com.alks.function.data.dto.finance.fincons.InventoryPaymentDetailsDto;
import com.alks.function.data.request.chengKong.PcStitchProdDetailRequest;
import com.alks.function.data.request.finance.fincons.PcStitchDetailAttachRequest;
import com.alks.function.service.chengKong.PcStitchProdDetailService;
import com.alks.function.service.finance.fincons.SewingProductionDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@Slf4j
@Api(value = "财务部-工厂-财务咨询查询", tags = {"财务部-针车员工产量"})
@ApiRestController("/SewingProductionData")
@RoleCheck(prgIds = {"190224","180505"})
public class SewingProductionDataController {

    @Autowired
    private SewingProductionDataService sewingProductionDataService;

    @PostMapping("/getYieldDetails")
    @ApiOperation(value = "查询产量明细",tags = "财务部-针车员工产量")
    public ResponseInfo getYieldDetails(@RequestBody PcStitchProdDetailRequest request) {
        return sewingProductionDataService.getYieldDetails(request);
    }

    @PostMapping("/getYieldDetailsCount")
    @ApiOperation(value = "查询产量明细的数量",tags = "财务部-针车员工产量")
    public ResponseInfo getYieldDetailsCount(@RequestBody PcStitchProdDetailRequest request) {
        return sewingProductionDataService.getYieldDetailsCount(request);
    }

    @PostMapping("/getInventoryPaymentDetails")
    @ApiOperation(value = "查询缴库明细",tags = "财务部-针车员工产量")
    public ResponseInfo getInventoryPaymentDetails(@RequestBody PcStitchDetailAttachRequest request) {
        return sewingProductionDataService.getInventoryPaymentDetails(request);
    }

    @PostMapping("/getInventoryPaymentCount")
    @ApiOperation(value = "查询缴库明细的已报产量",tags = "财务部-针车员工产量")
    public ResponseInfo getInventoryPaymentCount(@RequestBody PcStitchDetailAttachRequest request) {
        return sewingProductionDataService.getInventoryPaymentCount(request);
    }

    @WebLogger
    @PostMapping("/exportYieldDetails")
    @ApiOperation(value = "导出产量明细",tags = "财务部-针车员工产量")
    public void exportYieldDetails(@RequestBody PcStitchProdDetailRequest request, HttpServletResponse response) throws IOException {
        sewingProductionDataService.exportYieldDetails(request,response);
    }

    @WebLogger
    @PostMapping("/exportLotNoYield")
    @ApiOperation(value = "导出指令产量明细",tags = "财务部-针车员工产量")
    public void exportLotNoYield(@RequestBody PcStitchProdDetailRequest request, HttpServletResponse response) throws IOException {
        sewingProductionDataService.exportLotNoYield(request,response);
    }

    @WebLogger
    @PostMapping("/exportInventoryPaymentDetails")
    @ApiOperation(value = "导出缴库明细",tags = "财务部-针车员工产量")
    public void exportInventoryPaymentDetails(@RequestBody PcStitchDetailAttachRequest request, HttpServletResponse response) throws IOException {
        sewingProductionDataService.exportInventoryPaymentDetails(request,response);
    }

}
